package csel.controller.commands;

import csel.model.Entity;
import csel.model.Model;
import csel.model.GameCommand;
import csel.view.StatusViewport;
import csel.view.Viewport;

public class SaveCommand implements GameCommand
{
	private Model model;
	private Viewport viewport;
	private String fileName;
	
	//construct new save command
	public SaveCommand(Model model, Viewport viewport)
	{
		this.model = model;
		this.viewport = viewport;
		this.fileName = viewport.promptSaveDialog();
	}
	
	//call the model method save with the given filename after checking if it is null or not
	public void execute()
	{
		if (fileName != null)
		{
			model.save(fileName);
		}
		System.out.println("[MODEL] the Save command has been called");
	}

}